import re

mystr = re.sub(r"[^/]?(\d+)$", "", "http://www.mzitu.com/97034/8")

print(mystr)